package com.notnull.controller;

import com.alibaba.fastjson.JSONObject;
import exam.config.Result;
import org.hibernate.validator.constraints.Length;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

/**
 * @author Xiongx
 * @version 1.0
 * @date 2021/5/30 18:22
 * @since JDK 1.8
 */
@RestController
@RequestMapping("valited")
@Validated
public class ValitedController {

    @GetMapping("/test")
    public JSONObject testValitedControler(@NotNull @Length(max = 100,min = 6) @RequestParam(value = "username",required = true)  String username){
        System.out.println(username==null+"username是为空吗");
        System.out.println(username+"这是username");
        return Result.successInfo("你访问到我了"+username);
    }
}
